package com.capgemini.fs.app.ekms.model;

import java.util.Date;
import java.util.Set;

import com.capgemini.fs.app.ekms.service.util.SHAPasswordEncoder;

public class User extends Entity implements java.io.Serializable {

	private static final long serialVersionUID = -4263795518223462282L;
	private String userName;
	private String password;
    private String firstName;
    private String lastName;
	private Integer status;
	private String email;
	private String phoneNo;
	private int workExperience;
	private Integer memberType;
	private Date entryDate;
	private Set<Role> roles;
	private Set<Topic> topics;
	private Set<Forum> moderatoredForums;
	private Set<Group> groups;
	private Set<Forum> memberOfForums;
	private Set<Reply> replies;
	
	public Set<Reply> getReplies() {
		return replies;
	}

	public void setReplies(Set<Reply> replies) {
		this.replies = replies;
	}

	public Set<Forum> getMemberOfForums() {
		return memberOfForums;
	}

	public void setMemberOfForums(Set<Forum> memberOfForums) {
		this.memberOfForums = memberOfForums;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhoneNo() {
		return phoneNo;
	}

	public void setPhoneNo(String phoneNo) {
		this.phoneNo = phoneNo;
	}

	public int getWorkExperience() {
		return workExperience;
	}

	public void setWorkExperience(int workExperience) {
		this.workExperience = workExperience;
	}

	public Integer getMemberType() {
		return memberType;
	}

	public void setMemberType(Integer memberType) {
		this.memberType = memberType;
	}

	public Date getEntryDate() {
		return entryDate;
	}

	public void setEntryDate(Date entryDate) {
		this.entryDate = entryDate;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public Set<Group> getGroups() {
		return groups;
	}

	public void setGroups(Set<Group> groups) {
		this.groups = groups;
	}

	public Set<Forum> getModeratoredForums() {
		return moderatoredForums;
	}

	public void setModeratoredForums(Set<Forum> moderatoredForums) {
		this.moderatoredForums = moderatoredForums;
	}


	public Set<Topic> getTopics() {
		return topics;
	}

	public void setTopics(Set<Topic> topics) {
		this.topics = topics;
	}


	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setSecurityPassword(String password) {
		if (null == password) {
			return;
		}

		String hash = null;
		try {
			hash = new SHAPasswordEncoder().encode(password);
		} catch (Exception e) {
			// logger.error("Exception : " + e);
			e.printStackTrace();
		}
		this.password = hash;
	}

}
